package com.example.disconf.main;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.baidu.disconf.client.DisconfMgrBean;
import com.baidu.disconf.client.DisconfMgrBeanSecond;

/**
 * Created by wenjl on 2015/8/5.
 */
@Configuration
@EnableAutoConfiguration
public class SpringConfiguration {

	@Bean(name="disconfMgrBean", destroyMethod="destroy")
	public DisconfMgrBean disconfMgrBean() {
		DisconfMgrBean disconfMgrBean = new DisconfMgrBean();
		
		disconfMgrBean.setScanPackage("com.example");
		
		return disconfMgrBean;
	}
	
	@Bean(name="disconfMgrBean2", destroyMethod="destroy", initMethod="init")
	public DisconfMgrBeanSecond disconfMgrBean2() {
		DisconfMgrBeanSecond disconfMgrBean = new DisconfMgrBeanSecond();
		
		return disconfMgrBean;
	}
	
//	@Bean(name="configproperties_disconf")
//	public ReloadablePropertiesFactoryBean configpropertiesDisconf() {
//		ReloadablePropertiesFactoryBean configpropertiesDisconf = new ReloadablePropertiesFactoryBean();
//		
//		configpropertiesDisconf.setLocations(Arrays.asList("classpath*:autoconfig.properties"));
//		return configpropertiesDisconf;
//	}
}
